#! /bin/bash
# Program:
#    Start the ring_node

if [ $# -lt 1 ]
then
   echo -e "Please specify the config file path:\n" \
    "Usage: startnode config_file"
   exit 0
fi

base="`dirname $(which "$0")`/.."
ROOTDIR=`(cd "$base"; echo $PWD)`

export AI_ROOT=$ROOTDIR
export AI_CONF_PATH=$ROOTDIR/conf
#echo $AI_CONF_PATH

mnesia_dir=/var/ai_ring/$1

erl -setcookie abc \
    +K true \
    +A 32 \
    +W w \
    -pa ./ebin \
    -config $1 \
    -mnesia dir \'$mnesia_dir\'  \
    -ringlord $2 \
    -s airing_app
